package com.ciaojian.core.service;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ciaojian.core.mapper.DistRecordMapper;
import com.ciaojian.core.model.DistRecord;

/**
 * @author oxiny
 */
public abstract class DistRecordService<M extends BaseMapper<T>, T> extends ServiceImpl<DistRecordMapper, DistRecord> {

    /**
     * 查询被分享用户领取数
     *
     * @param targetId 被分享用户
     * @return 领取数
     */
    public Integer countByTargetId(Integer targetId) {
        return this.lambdaQuery().eq(DistRecord::getTargetId, targetId).count();
    }
}
